#include<iostream>
#define int long long 
using namespace std;

int func(int x){
	int bitcnt=1;
	while(x){
		bitcnt++;
		x>>=1;
	}
	return bitcnt;
}

void solve(){
	int x;
	cin>>x;
	int g=func(x);
	int ans=2*(g-1)+1;
	cout<<ans<<endl;
	return ;
}

signed main(){
	int t;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
} 
